{template '_header'}


<div class="page-heading"> <h2><i class="fa fa-circle-o"></i>会员管理</h2> <h2><i class="fa fa-circle-o"></i>会员总数 {$total}人</h2></div>

  <form action="./index.php" method="get" class="form-horizontal table-search" role="form">
                <input type="hidden" name="c" value="site" />
                <input type="hidden" name="a" value="entry" />
                <input type="hidden" name="m" value="ewei_shopv2" />
                <input type="hidden" name="do" value="web" />
                <input type="hidden" name="r" value="member.list" />
<div class="page-toolbar row m-b-sm m-t-sm">
                            <div class="col-sm-4">

			   <div class="input-group-btn">
			        <button class="btn btn-default btn-sm"  type="button" data-toggle='refresh'><i class='fa fa-refresh'></i></button>
				  {ifp 'member.list.edit'}
			             <button class="btn btn-default btn-sm" type="button" data-toggle='batch' data-href="{php echo webUrl('member/list/setblack',array('isblack'=>1))}"><i class='fa fa-user'></i> 设置黑名单</button>
				   <button class="btn btn-default btn-sm" type="button" data-toggle='batch'  data-href="{php echo webUrl('member/list/setblack',array('isblack'=>0))}"><i class='fa fa-user-o'></i> 取消黑名单</button>
				   {/if}


				{ifp 'member.list.delete'}
			              <button class="btn btn-default btn-sm" type="button" data-toggle='batch-remove' data-confirm="确认要删除?" data-href="{php echo webUrl('member/list/delete')}"><i class='fa fa-trash'></i> 删除</button>
				 {/if}
			   </div>
                               </div>


                            <div class="col-sm-6 pull-right">

				<div class="input-group">
                                          <input type="text" class="form-control input-sm"  name="realname" value="{$_GPC['realname']}" placeholder="可搜索昵称/姓名/手机号/ID"/>
				 <span class="input-group-btn">

                                        <button class="btn btn-sm btn-primary" type="submit"> 搜索</button>
                                        <button type="submit" name="export" value="1" class="btn btn-success btn-sm">导出</button>
										<button class="btn btn-sm btn-default" type="button" onclick="$('#moresearch').toggle()"> 其他 <i class="fa fa-angle-down"></i></button>
				</span>
                                </div>

                            </div>
</div>
				<div class="page-toolbar row" {if $_GPC['followed']=='' && $_GPC['level']=='' && $_GPC['groupid']=='' && $_GPC['isblack']=='' && $_GPC['time']['start']==''  && $_GPC['time']['end']=='' }style='display:none;'{/if} id='moresearch' >


					<div class="col-sm-12">

			 	  <select name='followed' class='form-control  input-sm select-md' style="width:140px">
								<option value=''>关注</option>
								<option value='0' {if $_GPC['followed']=='0'}selected{/if}>未关注</option>
								<option value='1' {if $_GPC['followed']=='1'}selected{/if}>已关注</option>
								<option value='2' {if $_GPC['followed']=='2'}selected{/if}>取消关注</option>
							</select>


	<select name='level' class='form-control  input-sm select-md' style="width:140px;"  >
                        <option value=''>等级</option>
                        {loop $levels $level}
                        <option value='{$level['id']}' {if $_GPC['level']==$level['id']}selected{/if}>{$level['levelname']}</option>
                        {/loop}
                    </select>
		<select name='groupid' class='form-control  input-sm select-md' style="width:140px;"  >
                        <option value=''>分组</option>
                        {loop $groups $group}
                        <option value='{$group['id']}' {if $_GPC['groupid']==$group['id']}selected{/if}>{$group['groupname']}</option>
                        {/loop}
                    </select>

                       <select name='isblack'  class='form-control  input-sm select-md'   style="width:140px;"  >
                        <option value=''>黑名单</option>
                        <option value='0' {if $_GPC['isblack']=='0'}selected{/if}>否</option>
                        <option value='1' {if $_GPC['isblack']=='1'}selected{/if}>是</option>
                    </select>


                        {php echo tpl_daterange('time', array('sm'=>true, 'placeholder'=>'注册时间'),true);}




                            </div>


				</div>
  </form>

 
        <table class="table table-hover table-responsive">
            <thead class="navbar-inner">
                <tr>
                      <th style="width:25px;"><input type='checkbox' /></th>
		 

                    <th style="width:150px;">粉丝</th>
                    <th style="width:120px;">会员信息</th>
                    
                    <th style="width:100px;">等级/分组</th>
                    <th style="width:100px;">注册时间</th>
                    <th style="width:100px;">积分/余额</th>
                    <th style="width:100px;">成交</th>
                    
                    <th style="width:100px;">关注/黑名单</th>
                    <th style="width:70px;">操作</th>
                </tr>
            </thead>
            <tbody>
                {loop $list $row}
                <tr rel="pop" data-title="ID: {$row['id']} " data-content="推荐人 <br/> {if empty($row['agentid'])}
				  {if $row['isagent']==1}
				      <label class='label label-primary'>总店</label>
				      {else}
				       <label class='label label-default'>暂无</label>
				      {/if}
				{else}
				
                    	{if !empty($row['agentavatar'])}
                         <img src='{$row['agentavatar']}' style='width:20px;height:20px;padding1px;border:1px solid #ccc' />
                       {/if}
                       [{$row['agentid']}]{if empty($row['agentnickname'])}未更新{else}{$row['agentnickname']}{/if}
					   {/if}">
					
			
                   	<td style="position: relative; ">
					<input type='checkbox'   value="{$row['id']}"/></td>
                    <td  >
			<div  >
                    	{if !empty($row['avatar'])}
                         <img src='{$row['avatar']}' style='width:30px;height:30px;padding1px;border:1px solid #ccc' />
                       {/if}
                       {if empty($row['nickname'])}未更新{else}{$row['nickname']}{/if}
                        </div>
                    </td>
                    <td>{$row['realname']}<br/><span {if !empty($row['mobileverify'])}class="text-info" title="已绑定"{/if}>{$row['mobile']}</span></td>
                    
                    <td>{if empty($row['levelname'])}普通会员{else}{$row['levelname']}{/if}
                        <br/>{if empty($row['groupname'])}无分组{else}{$row['groupname']}{/if}</td>
      
                    <td>{php echo date("Y-m-d",$row['createtime'])}<br/>{php echo date("H:i:s",$row['createtime'])}</td>
                    <td><label class="label label-primary">积分: {php echo intval($row['credit1'])}</label>
						<br/><label class="label label-danger">余额: {$row['credit2']}</label></td>
                    
                    <td><label class="label label-primary">订单: {$row['ordercount']}</label>
						<br/><label class="label label-danger">金额: {php echo floatval($row['ordermoney'])}</label></td>
                    <td> 
		 
						{if empty($row['followed'])}
                            {if empty($row['unfollowtime'])}
                                <label class='label label-default'>未关注</label>
                            {else}
                                <label class='label label-warning'>取消关注</label>
                            {/if}
                        {else}
                            <label class='label label-success'>已关注</label>
                        {/if}
					
					<br/><label class='label {if $row['isblack']==1}label-error{else}label-primary{/if}' 
										  {ifp 'member.list.edit'}
										  data-toggle='ajaxSwitch' 
										  data-switch-value='{$row['isblack']}'
										  data-switch-value0='0|正常|label label-primary|{php echo webUrl('member/list/setblack',array('isblack'=>1,'id'=>$row['id']))}'
										  data-switch-value1='1|黑名单|label label-error|{php echo webUrl('member/list/setblack',array('isblack'=>0,'id'=>$row['id']))}'
										  {/if}
					>
										  {if $row['isblack']==1}黑名单{else}正常{/if}</label>
					
					</td>
             
                      
                            <td  style="overflow:visible;">
                        
                        <div class="btn-group btn-group-sm" >
                                <a class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false" href="javascript:;">操作 <span class="caret"></span></a>
                                <ul class="dropdown-menu dropdown-menu-left" role="menu" style='z-index: 9999'>
                               
                        {ifp 'member.list.detail'}
                        	<li><a href="{php echo webUrl('member/list/detail',array('id' => $row['id']));}" title="会员详情"><i class='fa fa-edit'></i> 会员详情</a></li>
                        {/if}
                        {ifp 'order.list'}
                        	<li><a href="{php echo webUrl('order/list', array('searchfield'=>'member','keyword'=>$row['nickname']))}" title='会员订单'><i class='fa fa-list'></i> 会员订单</a></li>
                        {/if}
                        {ifp 'finance.recharge.credit1'}<li><a data-toggle="ajaxModal" href="{php echo webUrl('finance/recharge', array('type'=>'credit1','id'=>$row['id']))}" title='充值积分'><i class='fa fa-credit-card'></i> 充值积分</a></li>{/if}
                        {ifp 'finance.recharge.credit2'}<li><a data-toggle="ajaxModal" href="{php echo webUrl('finance/recharge', array('type'=>'credit2','id'=>$row['id']))}" title='充值余额'><i class='fa fa-money'></i> 充值余额 </a></li>{/if}
                        {ifp 'member.list.delete'}<li><a  data-toggle='ajaxRemove'  href="{php echo webUrl('member/list/delete',array('id' => $row['id']));}" title='删除会员' data-confirm="确定要删除该会员吗？"><i class='fa fa-remove'></i> 删除会员</a></li>{/if}
                                </ul>
                            </div>

               
                    </td>
                </tr>
                {/loop}
            </tbody>
        </table>
           {$pager}
		   <script language="javascript">
			     {if $opencommission}
			require(['bootstrap'],function(){
        $("[rel=pop]").popover({
            trigger:'manual',
            placement : 'left', 
            title : $(this).data('title'),
            html: 'true', 
            content : $(this).data('content'),
            animation: false
        }).on("mouseenter", function () {
                    var _this = this;
                    $(this).popover("show"); 
                    $(this).siblings(".popover").on("mouseleave", function () {
                        $(_this).popover('hide');
                    });
                }).on("mouseleave", function () {
                    var _this = this;
                    setTimeout(function () {
                        if (!$(".popover:hover").length) {
                            $(_this).popover("hide")
                        }
                    }, 100);
                });
 
	 
	   });
	{/if}
			   
</script>
{template '_footer'}